﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="ThanhToan.aspx.cs" Inherits="GUI.ThanhToan" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript" language="javascript">
        function ktNhapDienThoai(e, args) {
            if (args.Value.length >= 0 && args.Value.length <= 18 && isNaN(args.Value) != true)
                args.IsValid = true;
            else
                args.IsValid = false;
        }
        function ktNhapCMND(e, args) {
            if (args.Value.length >= 6 && args.Value.length <= 15 && isNaN(args.Value) != true)
                args.IsValid = true;
            else
                args.IsValid = false;
        }
    </script>
    <div class="title_content">
        Thanh Toán</div>
    <div class="border_content">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:Panel ID="Panel1" runat="server">
                    <div class="tieude">
                        Thông tin khách hàng</div>
                    <div class="thongtin">
                        <table style="width: 100%" border="0" cellpadding="5" cellspacing="2">
                            <tr>
                                <td style="width: 175px" align="right">
                                    Họ và tên:<em>*</em>
                                </td>
                                <td width="220px;">
                                    <asp:TextBox ID="txthoten" runat="server" Width="215px"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txthoten"
                                        Display="Dynamic" ErrorMessage="(*) Không được bỏ trống" ForeColor="Red" SetFocusOnError="True"
                                        ValidationGroup="Nhap"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 175px" align="right">
                                    Địa chỉ: <em>*</em>
                                </td>
                                <td width="220px;">
                                    <asp:TextBox ID="txtdiachi" runat="server" Width="215px"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtdiachi"
                                        Display="Dynamic" ErrorMessage="(*) Không được bỏ trống" ForeColor="Red" SetFocusOnError="True"
                                        ValidationGroup="Nhap"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 175px" align="right">
                                    Điện thoại:<em>*</em>
                                </td>
                                <td width="220px;">
                                    <asp:TextBox ID="txtdienthoai" runat="server" Width="215px"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtdienthoai"
                                        Display="Dynamic" ErrorMessage="(*) Không được bỏ trống" ForeColor="Red" SetFocusOnError="True"
                                        ValidationGroup="Nhap"></asp:RequiredFieldValidator>
                                    <asp:CustomValidator ID="CustomValidatorDienThoai" runat="server" ControlToValidate="txtdienthoai"
                                        Display="Dynamic" ErrorMessage="(*) Điện thoại chưa đúng" SetFocusOnError="True"
                                        ClientValidationFunction="ktNhapDienThoai" ForeColor="Red" ValidationGroup="Nhap"></asp:CustomValidator>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 175px" align="right">
                                    Số CMND:<em>*</em>
                                </td>
                                <td width="220px;">
                                    <asp:TextBox ID="TextBoxCMND_KhachHang" runat="server" Width="215px"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="TextBoxCMND_KhachHang"
                                        Display="Dynamic" ErrorMessage="(*) Không được bỏ trống" ForeColor="Red" SetFocusOnError="True"
                                        ValidationGroup="Nhap"></asp:RequiredFieldValidator>
                                    <asp:CustomValidator ID="CustomValidator2" runat="server" ControlToValidate="TextBoxCMND_KhachHang"
                                        Display="Dynamic" ErrorMessage="(*) CMND chưa đúng" SetFocusOnError="True" ClientValidationFunction="ktNhapCMND"
                                        ForeColor="Red" ValidationGroup="Nhap"></asp:CustomValidator>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 175px" align="right">
                                    Email:
                                </td>
                                <td width="220px;">
                                    <asp:TextBox ID="txtemail" runat="server" Width="215px" ReadOnly="True"></asp:TextBox>
                                </td>
                                <td>
                                    &nbsp;
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div id="Div1">
                    </div>
                    <div class="tieude">
                        Thông tin người nhận</div>
                    <div class="thongtin">
                        <table style="width: 100%" border="0" cellpadding="5" cellspacing="2">
                            <tr>
                                <td style="width: 175px">
                                    <asp:CheckBox ID="ckbGiongKhachHang" runat="server" Text=" Giống thông tin khách hàng"
                                        AutoPostBack="true" OnCheckedChanged="ckbGiongKhachHang_CheckedChanged" />
                                </td>
                                <td colspan="2">
                                    Địa chỉ khác:
                                    <asp:DropDownList ID="DropDownListDiaChiKhac" runat="server" Width="235px" AutoPostBack="true"
                                        OnSelectedIndexChanged="DropDownListDiaChiKhac_SelectedIndexChanged">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 175px" align="right">
                                    Họ và tên:<em>*</em>
                                </td>
                                <td width="220px;">
                                    <asp:TextBox ID="txthotennguoinhan" runat="server" Width="215px" AutoPostBack="True"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txthotennguoinhan"
                                        Display="Dynamic" ErrorMessage="(*) Không được bỏ trống" ForeColor="Red" SetFocusOnError="True"
                                        ValidationGroup="Nhap"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 175px" align="right">
                                    Địa chỉ:<em>*</em>
                                </td>
                                <td width="220px;">
                                    <asp:TextBox ID="txtdiachinguoinhan" runat="server" Width="215px"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="txtdiachinguoinhan"
                                        Display="Dynamic" ErrorMessage="(*) Không được bỏ trống" ForeColor="Red" SetFocusOnError="True"
                                        ValidationGroup="Nhap"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 175px" align="right">
                                    Điện thoại:<em>*</em>
                                </td>
                                <td width="220px;">
                                    <asp:TextBox ID="txtdienthoainguoinhan" runat="server" Width="215px"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="txtdienthoainguoinhan"
                                        Display="Dynamic" ErrorMessage="(*) Không được bỏ trống" ForeColor="Red" SetFocusOnError="True"
                                        ValidationGroup="Nhap"></asp:RequiredFieldValidator>
                                    <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="txtdienthoainguoinhan"
                                        Display="Dynamic" ErrorMessage="(*) Điện thoại chưa đúng" SetFocusOnError="True"
                                        ClientValidationFunction="ktNhapDienThoai" ForeColor="Red" ValidationGroup="Nhap"></asp:CustomValidator>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 175px" align="right">
                                    Số CMND:<em>*</em>
                                </td>
                                <td width="220px;">
                                    <asp:TextBox ID="TextBoxCMND_NguoiNhan" runat="server" Width="215px"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="TextBoxCMND_NguoiNhan"
                                        Display="Dynamic" ErrorMessage="(*) Không được bỏ trống" ForeColor="Red" SetFocusOnError="True"
                                        ValidationGroup="Nhap"></asp:RequiredFieldValidator>
                                    <asp:CustomValidator ID="CustomValidator3" runat="server" ControlToValidate="TextBoxCMND_NguoiNhan"
                                        Display="Dynamic" ErrorMessage="(*) CMND chưa đúng" SetFocusOnError="True" ClientValidationFunction="ktNhapCMND"
                                        ForeColor="Red" ValidationGroup="Nhap"></asp:CustomValidator>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div id="Div2">
                    </div>
                    <div class="tieude">
                        Phương thức thanh toán
                    </div>
                    <div class="thongtin">
                        <table style="width: 100%" border="0" cellpadding="5" cellspacing="2">
                            <tr>
                                <td style="width: 175px" align="right">
                                    &nbsp;
                                </td>
                                <td width="220px;">
                                    <asp:DropDownList ID="DropDownListPhuongThucThanhToan" Width="220px" runat="server">
                                    </asp:DropDownList>
                                </td>
                                <td>
                                    <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="DropDownListPhuongThucThanhToan"
                                        Display="Dynamic" ErrorMessage="(*) Không được bỏ trống" Operator="NotEqual"
                                        SetFocusOnError="True" ValidationGroup="Nhap" ValueToCompare="Default" ForeColor="Red"></asp:CompareValidator>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div class="tieude">
                        Phương thức giao hàng
                    </div>
                    <div class="thongtin">
                        <table width="100%" cellspacing="2" cellpadding="5">
                            <tr>
                                <td style="width: 175px" align="right">
                                    <asp:Label ID="LabelMaKhachHang" runat="server" Text="Label" Visible="false"></asp:Label>
                                </td>
                                <td width="220px;">
                                    <asp:DropDownList ID="DropDownListPhuongThucGiaoHang" Width="220px" runat="server">
                                    </asp:DropDownList>
                                </td>
                                <td>
                                    <asp:CompareValidator ID="CompareValidator2" runat="server" ControlToValidate="DropDownListPhuongThucGiaoHang"
                                        Display="Dynamic" ErrorMessage="(*) Không được bỏ trống" Operator="NotEqual"
                                        SetFocusOnError="True" ValidationGroup="Nhap" ValueToCompare="Default" ForeColor="Red"></asp:CompareValidator>
                                </td>
                            </tr>
                        </table>
                    </div>
                </asp:Panel>
                <asp:Panel ID="Panel2" runat="server">
                    <div class="tieude">
                        Thông tin khách hàng</div>
                    <div class="thongtin">
                        <table style="width: 100%" border="0" cellpadding="5" cellspacing="2">
                            <tr>
                                <td style="width: 175px" align="right">
                                    Họ và tên:
                                </td>
                                <td>
                                    <asp:Label ID="lblHoTenKH" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 175px" align="right">
                                    Địa chỉ:
                                </td>
                                <td>
                                    <asp:Label ID="lblDiaChiKH" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 175px" align="right">
                                    Điện thoại:
                                </td>
                                <td>
                                    <asp:Label ID="lblDienThoaiKH" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 175px" align="right">
                                    Số CMND:
                                </td>
                                <td>
                                    <asp:Label ID="LabelCMND_KhachHang" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 175px" align="right">
                                    Email:
                                </td>
                                <td>
                                    <asp:Label ID="lblEmailKH" runat="server"></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div id="Div3">
                    </div>
                    <div class="tieude">
                        Thông tin người nhận</div>
                    <div class="thongtin">
                        <table style="width: 100%" border="0" cellpadding="5" cellspacing="2">
                            <tr>
                                <td style="width: 175px" align="right">
                                    Họ và tên:
                                </td>
                                <td>
                                    <asp:Label ID="lblHoTenNN" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 175px" align="right">
                                    Địa chỉ:
                                </td>
                                <td>
                                    <asp:Label ID="lblDiaChiNN" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 175px" align="right">
                                    Điện thoại:
                                </td>
                                <td>
                                    <asp:Label ID="lblDienThoaiNN" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 175px" align="right">
                                    Số CMND:
                                </td>
                                <td>
                                    <asp:Label ID="LabelCMND_NguoiNhan" runat="server"></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div class="tieude">
                        Phương thức thanh toán
                    </div>
                    <div class="thongtin">
                        <table style="width: 100%" border="0" cellpadding="5" cellspacing="2">
                            <tr>
                                <td align="center">
                                    <asp:Label ID="lblPTTT" runat="server"></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div class="tieude">
                        Phương thức giao hàng
                    </div>
                    <div class="thongtin">
                        <table width="100%" cellspacing="2" cellpadding="5">
                            <tr>
                                <td align="center">
                                    <asp:Label ID="lblPTGH" runat="server"></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <br />
                    <br />
                    <!--Ajax image here-->
                    <div style="text-align: center;">
                        <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
                            <ProgressTemplate>
                                <img src="Home/css/images/loading.gif" alt="Loading" />
                                Đang xử lý ...
                            </ProgressTemplate>
                        </asp:UpdateProgress>
                    </div>
                    <!--End Ajax image here-->
                    <div class="tieude">
                        Thông tin giỏ hàng
                    </div>
                    <div class="thongtin">
                        <asp:GridView ID="GVGioHang" runat="server" AutoGenerateColumns="False" BackColor="White"
                            BorderColor="#e4e4e4" BorderStyle="None" BorderWidth="1px" CellPadding="4" EnableModelValidation="True"
                            ShowFooter="True" Width="100%" OnRowDataBound="GVGioHang_RowDataBound">
                            <Columns>
                                <asp:TemplateField HeaderText="Mã Sản Phẩm">
                                    <ItemTemplate>
                                        <asp:Label ID="lblmasanpham" runat="server" Text='<%# Eval("masanpham") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Tên Sản Phẩm">
                                    <ItemTemplate>
                                        <asp:Label ID="lbltensanpham" runat="server" Text='<%# Eval("tensanpham") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Số Lượng">
                                    <FooterTemplate>
                                    </FooterTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="lblsoluong" runat="server" Text='<%# Eval("soluong") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Đơn Giá">
                                    <FooterTemplate>
                                        <asp:Label ID="Label9" runat="server" Font-Bold="True" Text="Tổng Tiền: "></asp:Label>
                                        &nbsp;
                                    </FooterTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="lbldongia" runat="server" Text='<%# Eval("giaban", "{0:0,0 vnđ}") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Thành Tiền">
                                    <FooterTemplate>
                                        <asp:Label ID="lbltongtien" runat="server" Font-Bold="True" Font-Size="Small" ForeColor="#CC3300"
                                            Text=""></asp:Label>
                                        &nbsp;VNĐ
                                    </FooterTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="lblthanhtien" runat="server" Text='<%# Eval("thanhtien", "{0:0,0 vnđ}") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <EmptyDataTemplate>
                                <h4>
                                    Không có sản phẩm nào trong giỏ hàng&nbsp;
                                    <asp:HyperLink ID="hplquayvetrangchu" runat="server" ForeColor="#3399FF" NavigateUrl="~/Default.aspx">quay về trang chủ</asp:HyperLink>
                                </h4>
                            </EmptyDataTemplate>
                            <FooterStyle BackColor="#D8C0E6" ForeColor="#330099" />
                            <HeaderStyle BackColor="#9F5DA1" Font-Bold="True" ForeColor="#FFFFFF" />
                            <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
                            <RowStyle BackColor="White" ForeColor="#330099" />
                            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
                        </asp:GridView>
                    </div>
                </asp:Panel>
                <asp:Panel ID="Panel3" runat="server">
                    <div class="thongtin">
                        <div class="tieude">
                            <br />
                            Chúc mừng khách hàng đã đặt hàng thành công!
                            <br />
                            <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Default.aspx">Quay về trang chủ</asp:HyperLink>
                            &nbsp;&nbsp;&nbsp;&nbsp;
                            <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/LichSuMuaHang.aspx">Xem lịch sử mua hàng</asp:HyperLink>
                            <br />
                        </div>
                    </div>
                </asp:Panel>
                <%
                    if (Session["GioHang"] != null)
                    { 
                %>
                <table style="width: 100%" border="0" cellpadding="5" cellspacing="2">
                    <tr>
                        <td colspan="3" style="text-align: center;">
                            <asp:Button ID="btnnhaplai" runat="server" Width="120px" Text="Nhập lại" OnClick="btnnhaplai_Click" />
                            &nbsp;<asp:Button ID="btnQuayLai" Width="120px" runat="server" Text="<< Quay lại"
                                OnClick="btnQuayLai_Click" />
                            &nbsp;<asp:Button ID="btndongy" runat="server" Width="120px" Text="Tiếp tục >>" ValidationGroup="Nhap"
                                OnClick="btndongy_Click" />
                            &nbsp;<asp:Button ID="btnMuaHang" runat="server" Width="120px" Text="Đồng ý mua hàng"
                                OnClick="btnMuaHang_Click" />
                        </td>
                    </tr>
                </table>
                <%
                    }
                %>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    <div id="clear">
    </div>
</asp:Content>
